package com.test.ch05;

public class Duration {
    private int hour;
    private int min;
    private int sec;
    public Duration()
    {

    }
    public Duration(int hour,int min,int sec)
    {
        this.hour=hour;
        this.min=min;
        this.sec=sec;
    }
    public Duration(int seconds)
    {
        this.hour=seconds/3600;
        this.min=seconds%3600/60;
        this.sec=seconds%3600%60;
    }
    public int getHour()
    {
        return this.hour;
    }
    public int getMin()
    {
        return this.min;
    }
    public int getSec()
    {
        return this.sec;
    }
    public int totalSeconds()
    {
        return this.hour*3600+this.min*60+this.sec;
    }
    public void disp()
    {
        System.out.println("time:"+this.hour+"/"+this.min+"/"+this.sec);
        System.out.println("totalseconds:"+totalSeconds());
    }
}
